<template>
  <div class="pay">
    <div class="address">
      <img src="https://hzyczn.52br.net/images/h5/icon/address.png" alt="" />
      <div class="text">
        <span> 南昌工学院新街店 </span>
        <span>
          <b>张帅</b>
          <b>15623149227</b>
        </span>
      </div>
    </div>
    <div class="logo">
      <img
        src="https://hzyczn.52br.net/images/h5/icon/logo.png"
        alt=""
      />紫气东澜
    </div>
    <div class="details">
      <div class="goodsList">
        <div v-for="item in carStore.carList" :key="item.id" class="item">
          <div class="leftImg">
            <img :src="item.src" alt="" />
          </div>
          <div class="rightContent">
            <div class="left">
              <span>{{ item.name }}</span>
              <p>高端洗涤,多重消毒</p>
            </div>
            <div class="right">
              <span
                >￥<b style="color: #d81e06; font-weight: 550">{{
                  item.price
                }}</b></span
              >
              <span
                >×<b>{{ item.total }}</b></span
              >
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="fuwu">
      <span><b>配送服务</b><b>到店自取</b></span>
      <span><b>跑腿费</b><b>￥0</b></span>
    </div>
    <div class="car">
      <div class="carleft">
        <span
          >实付：￥<b>{{ carStore.totalMoney }}</b></span
        >
      </div>
      <div class="carright">
        <button @click="goPay">提交订单</button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import wx from 'weixin-js-sdk'

import { useCarStore } from '@/stores'
const carStore = useCarStore()
// 付款
const goPay = () => {
  alert('付款成功!')
  wx.miniProgram.switchTab({
    url: '/pages/order/order'
  })
}
</script>

<style lang="less" scoped>
.pay {
  width: 96%;
  margin: 5vw auto;
  .address {
    display: flex;
    height: 23vw;
    align-items: center;
    padding: 0 2vw;
    border-radius: 3vw;
    background: #fff;
    img {
      width: 6vw;
      height: 7.2vw;
    }
    .text {
      display: flex;
      flex-direction: column;
      margin-left: 3vw;
      span:nth-child(1) {
        font-weight: bold;
      }
      span:nth-child(2) {
        margin-top: 1vw;
        b {
          font-weight: normal;
          font-size: 3.5vw;
          color: #b1b1b1;
          margin-right: 2vw;
        }
      }
    }
  }
  .logo {
    display: flex;
    margin-top: 2vw;
    padding: 0 2vw;
    padding-top: 2vw;

    border-radius: 3vw 3vw 0 0;
    background: #fff;
    img {
      width: 5.8667vw;
      height: 5.3333vw;
    }
  }
  .details {
    padding: 0 2vw;
    padding-top: 2vw;
    background: #fff;
    max-height: 50vh;
    overflow-y: auto;
    .item {
      display: flex;
      background: #fff;
      box-sizing: border-box;
      height: 26.6667vw;
      border-radius: 2.7vw;
      width: 96%;
      margin: 0 auto;
      .leftImg {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        img {
          width: 16vw;
          height: 16vw;
          border: 0.125vw solid #eee;
          border-radius: 2.75vw;
          padding: 2vw;
        }
      }
      .rightContent {
        flex: 2;
        display: flex;
        // flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 3.5vw 0;
        .left {
          width: 100%;
          text-align: left;
          span {
            display: block;
            color: rgba(0, 0, 0, 0.87);
          }
          p {
            font-size: 3.2vw;
            color: rgba(0, 0, 0, 0.54);
            margin-top: 1.25vw;
          }
        }
        .right {
          display: flex;
          flex-direction: column;
          align-items: end;
          span {
            b {
              font-weight: normal;
            }
          }
        }
      }
    }
  }
  .fuwu {
    display: flex;
    flex-direction: column;
    padding: 0 2vw;
    padding-top: 3vw;
    padding-bottom: 3vw;

    border-radius: 0 0 3vw 3vw;
    background: #fff;
    span {
      display: flex;
      justify-content: space-between;
      padding: 0 3vw;
      b {
        font-weight: normal;
      }
    }
  }
  .car {
    position: fixed;
    z-index: 100;
    left: 0;
    bottom: 0;
    box-sizing: border-box;
    background: #fff;
    width: 100%;
    height: 13.0667vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 10vw;
    padding-right: 7vw;
    .carleft {
      width: 50vw;
      height: 8vw;
      display: flex;
      align-items: center;
      span {
        display: flex;
        width: 100%;
        margin-left: 3vw;
        b {
          font-size: 5vw;
          color: #d81e06;
          font-weight: bold;
        }
      }
    }
    .carright {
      button {
        border: none;
        width: 25vw;
        height: 10vw;
        border-radius: 5vw;
        color: #fff;
        background: #b14094;
      }
    }
  }
}
</style>
